< previous page page_575 next page >

Page 575
9f31265bb40b592b1929e18a47ab28e5.gif
   CPUType = mlngCPUType
End Property

Public Property Get NumCPU() As Long
   Call GetSysInfo
   NumCPU = mlngNumCPU
End Property
The GetSysInfo() Method
To retrieve all the memory and system information, you need to make two different Windows API calls. Both calls rely on user-defined types that are passed in by reference and are returned with system information. The two calls are GlobalMemoryStatus() and GetSystemInfo():
9f31265bb40b592b1929e18a47ab28e5.gif
Private Sub GetSysInfo()
   Dim typMS As MEMORYSTATUS
   Dim typSI As SYSTEM_INFO

   ' If the current system information is not current,
   ' requery the system for it.
   If Not IsInfoCurrent() Then
      ' Get the global memory status information.
      typMS.dwLength = Len(typMS)
      Call GlobalMemoryStatus(typMS) 
      mlngMemoryLoad = typMS.dwMemoryLoad
      mlngTotalPhysical = typMS.dwTotalPhys
      mlngAvailPhysical = typMS.dwAvailPhys
      mlngTotalVirtual = typMS.dwTotalVirtual
      mlngAvailVirtual = typMS.dwAvailVirtual

      ' Get the system information.
      Call GetSystemInfo(typSI) 
      mlngNumCPU = typSI.dwNumberOrfProcessors
      mlngCPUType = typSI.dwProcessorType

      ' Get Windows Directory Information
      Call WinDirInfo

      

 
< previous page page_575 next page >

If you like this book, buy it!